#include "stdafx.h"
#include "Analyze.h"
#include <wtypes.h>
#include "..\Parser.h"

BOOL declare_type_integer()
{
	SymbolStack.Pop();
	NAutoPtr<CSyntaxTreeNode> Node = new CSyntaxTreeNode(CSyntaxTreeNode::stDeclare,CSyntaxTreeNode::dtInteger);
	ParserAnalyze.Push(Node);
	return TRUE;
}

BOOL declare_type_string()
{
	SymbolStack.Pop();
	NAutoPtr<CSyntaxTreeNode> Node = new CSyntaxTreeNode(CSyntaxTreeNode::stDeclare,CSyntaxTreeNode::dtString);
	ParserAnalyze.Push(Node);
	return TRUE;
}

BOOL declare_type_bool()
{
	SymbolStack.Pop();
	NAutoPtr<CSyntaxTreeNode> Node = new CSyntaxTreeNode(CSyntaxTreeNode::stDeclare,CSyntaxTreeNode::dtBool);
	ParserAnalyze.Push(Node);
	return TRUE;
}

BOOL declare_type_real()
{
	SymbolStack.Pop();
	NAutoPtr<CSyntaxTreeNode> Node = new CSyntaxTreeNode(CSyntaxTreeNode::stDeclare,CSyntaxTreeNode::dtReal);
	ParserAnalyze.Push(Node);
	return TRUE;
}

BOOL declare_desc_once()
{
	SymbolStack.Pop(); // as
	CLexer_Token_Ptr Ptr = SymbolStack.Pop();
	SymbolStack.Pop(); // declare
	ParserAnalyze.Top()->Child().Add(new CSyntaxTreeNode(CSyntaxTreeNode::stNull,0));
	return TRUE;
}

BOOL declare_desc_more()
{
	SymbolStack.Pop(); // as
	CLexer_Token_Ptr Ptr = SymbolStack.Pop();
	SymbolStack.Pop(); // operator ,
	ParserAnalyze.Top()->Child().Add(new CSyntaxTreeNode(CSyntaxTreeNode::stNull,0));
	return TRUE;
}